package cn.bigfire.wedesk;

import cn.bigfire.wedesk.net.initializer.TcpChannelInitializer;
import cn.bigfire.wedesk.net.initializer.WebSocketChannelInitializer;
import cn.bigfire.wedesk.net.protocol.CmdMapper;
import cn.bigfire.wedesk.net.protocol.TypeMapper;
import cn.bigfire.wedesk.util.TcpUtil;
import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ServerApp {

    public static void main(String[] args) {
        TcpUtil.serverStart(54320, new TcpChannelInitializer());
        TcpUtil.serverStart(54321, new WebSocketChannelInitializer());
        List<Integer> cmdList = new ArrayList<>(CmdMapper.methodMapper.keySet());
        List<Integer> typeList =  new ArrayList<>(TypeMapper.type2ClassMap.keySet());
        Collections.sort(cmdList);
        Collections.sort(typeList);
        System.out.println("成功注册协议号:" + JSON.toJSONString(cmdList));
        System.out.println("成功注册类型:" + JSON.toJSONString(typeList));
    }

}
